<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>消息列表</title>
</head>

<script type="text/javascript">
    var type = "${type}";
    var formSetting = {
        buttons: {
            custom: [
                {
                    id: "updatebtn0",
                    value: "使用模板",
                    click: function () {
                        /* var id = $("#businessModelDataGrid").jqGrid("getGridParam",
                         "selrow");
                         if(id) {
                         // 							window.location.href="declaration-bizView.do?id="+id;
                         window.location.href="business-checkDetail.do?id="+id+"&singleType=D&checkDetail=T&identification=list";
                         } else {
                         jw.alert("请点击需要操作的数据!");
                         } */
                        var selectedRowId = $("#businessModelDataGrid").getGridParam("selrow");
                        if (selectedRowId) {
                            var selectedRow = $("#businessModelDataGrid").getRowData(selectedRowId);
                            parent.loadBizFromHistoryData(selectedRow.business_id, "all",
                                                          selectedRow.is_record_info);
                            jw.close();
                        }
                        else {
                            jw.alert("请点击需要操作的数据!");
                        }
                    }
                },
            ]
        },
        grid: {
            id: "businessModelDataGrid",
            title: "查询结果",
            autowidth: false,
            url: "",
            colModel: [{
                index: "ID",
                name: "id",
                label: "id",
                hidden: true
            }, {
                index: "business_id",
                name: "business_id",
                label: "业务编号"
            }, {
                index: "MODEL_NAME",
                name: "model_name",
                width: 200,
                label: "模板名称"
            }, {
                index: "SAVE_MODEL_TIME",
                name: "save_model_time",
                width: 200,
                label: "保存模板时间",
                formatter: 'date',
                formatoptions: {srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s'}
            }, {
                index: "SAVE_MODEL_PERSON",
                name: "save_model_person",
                width: 200,
                label: "模板保存人"
            }, {
                index: "TYPE",
                name: "type",
                label: "模板类型",
                formatter: function (cellvalue, options, rowObject) {
                    if (cellvalue == "D") {
                        return "报关";
                    } else if (cellvalue == "C") {
                        return "拖车";
                    }
                }
            }, {
                index: "IS_RECORD_INFO",
                name: "is_record_info",
                label: "是否手册",
                hidden: true
            }],
            jsonReader: {
                root: "businessModelDtos"
            },
            loadComplete: function (data) {

            },
            ondblClickRow: function () {
                var selectedRowId = $("#businessModelDataGrid").getGridParam("selrow");
                if (selectedRowId) {
                    var selectedRow = $("#businessModelDataGrid").getRowData(selectedRowId);
                    parent.loadBizFromHistoryData(selectedRow.business_id, "all",
                                                  selectedRow.is_record_info);
                    jw.close();
                }
            }
        }
    };
    $(document).ready(function () {
        $("#businessModelDataTable").mrdForm(formSetting);
    });
</script>
<body>
<div id="businessModelDataTable"></div>
</body>
</html>
